<?php 

class Exam extends IController{

	public function add_do(){
		// echo "ok";
		$name = IReq::get('name');
		$pwd = IReq::get('pwd');
		$email = IReq::get('email');
		$data = array('name'=>$name,'pwd'=>$pwd,'email'=>$email,'status'=>0);
		$model = new IModel("b2");
		$model->setData($data);
		$res = $model->add();
		if ($res) {
			$title = "欢迎注册成为我们网站的会员";
			$url = "http://www.iwebshop.com/exam/act/id/".base64_encode($res);
			// echo $url;die();
			$content="请点击连接加入我们吧".$url;
			// echo $content;die();
			$mail = new SendMail();
			// print_r($mail);die();
			$mail->send($email,$title,$content);
		}
	}
	public function act(){
		// echo "ok";
		$id = $_GET['id'];
		$id = base64_decode($id);
		// echo $id;
		$data = array("status"=>1);
		$model = new IModel("b2");
		$model->setData($data);
		$res = $model->update("id=$id");
		if ($res) {
			$this->redirect("login");
		}
	}
	public function login_do(){
		$name = IReq::get('name');
		$pwd = IReq::get('pwd');
		$model = new IModel("b2");
		$res =  $model->query("name='$name' and pwd='$pwd'");
		if ($res[0]['status']==1) {
			echo "登录成功";
		}else{
			echo "请先去邮箱激活";
		}
	}





}

 ?>